@use "sass:color";
@use "../../variables.scss";

.Input {
  display: block;
  box-sizing: border-box;
  width: 100%;
  border: 1px solid variables.$border-color;
  border-radius: 4px;
  outline: 0;
  font-size: 12px;
  font-weight: normal;
  line-height: normal;
  color: variables.$text-color-primary;
  padding: 7px 12px 8px;
  transition: border 0.2s;
  height: 38px;

  &.darker {
    border: 1px solid color.adjust(variables.$border-color, $lightness: -20%);
    padding: 6px 10px 7px;
    height: 30px;
    width: 300px;
  }

  &.width-auto {
    width: auto;
  }

  &:active,
  &:focus {
    border-color: var(--primary-color);
  }

  &.larger {
    padding: 11px 12px 12px;
  }

  &.jumbo {
    font-size: 14px;
    font-weight: 500;
  }

  &.has-error,
  &.has-error:focus,
  &.has-error:active {
    border-color: var(--error-color);
  }
  &.is-disabled {
    user-select: none;
    cursor: not-allowed;
    background-color: #f8f8f8;
    border-color: variables.$border-color;
    color: variables.$text-color-accent;
  }
}

.Input::placeholder {
  color: #c4c7ca;
}

.hidden-input {
  position: absolute;
  left: -1000px;
  top: -1000px;
  opacity: 0;
}

/* Switch style checkbox */

input.Checkbox-toggle {
  opacity: 0.01;
  margin: 0;
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  right: 0;
  width: 100%;
  height: 100%;
  cursor: pointer;
  z-index: 2;
  cursor: pointer;
}
.Checkbox--switch {
  display: inline-block;
  border-radius: 100px;
  background: #f8f8f8;
  transition: all 0.2s ease;
  padding: 2px;
  width: 38px;
  height: 20px;
  max-height: 18px;
  position: relative;
  cursor: pointer;
  vertical-align: bottom;
  border: 1px solid variables.$border-color;
}
.Checkbox--switch.is-disabled {
  border: 1px solid variables.$border-color;
  opacity: 0.7;
}
.Checkbox--switch::before {
  display: none;
}
.Checkbox--switch::after {
  position: relative;
  display: block;
  content: "";
  top: -1px;
  width: 48%;
  height: 100%;
  background: #ffffff;
  border: 1px solid variables.$border-color;
  left: 0;
  cursor: pointer;
  border-radius: 50%;
  transition: left 0.2s ease-in-out, padding 0.2s ease, margin 0.2s ease;
  box-shadow: 0px 2px 2px 0px rgba(0, 0, 0, 0.1),
    inset -2px -2px 2px 0px rgba(23, 16, 52, 0.05);
  z-index: 1;
}
.Checkbox--switch::after:hover,
.Checkbox--switch::after:active,
.Checkbox--switch::after.is-checked {
  border: 1px solid variables.$border-color;
  background: #ffffff;
}

.Checkbox--switch.is-checked {
  background: var(--success-color);
  border: 1px solid var(--success-color);
}
.Checkbox--switch.is-checked::after {
  left: 49%;
}
